package lab3p3;

/**
 * <p>Title: GameDays</p>
 * <p>Description: CS 235 Lab #3</p>
 *         A simple Java graphical user interface program
 *         that keeps track of the dates of games.
 * @author Anthony Varghese
 * @date   August 8th 2013
 * @team   
 */

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;

public class GameDays extends JFrame implements ActionListener {
	/**
	 * Default serial version id so we don't get compiler warnings.
	 */
	private static final long serialVersionUID = 1L;

	private DatePanel date1;
	private DatePanel date2;
	private JButton check;
	
	
	/**
	 * Constructor
	 * @param title
	 */
	public GameDays(String title) {
		super(title);
		
		setBounds( 200, 100, 400, 300 );
		setLayout( null );

		date1 = new DatePanel("Game #1 is at");
		date1.setBounds( 10, 70, 380, 70);
		add( date1 );

		date2 = new DatePanel("Game #2 is at");
		date2.setBounds( 10, 150, 380, 70);
		add( date2 );

		check = new JButton("Check");
		check.setBounds( 70, 200, 90, 40);
		add( check );
		check.addActionListener( this );

		setDefaultCloseOperation( EXIT_ON_CLOSE );
		setVisible( true );
	}

	/**
	 * actionPerformed
	 * - gets the data in all the fields in response to a button click
	 */
	public void actionPerformed(ActionEvent e) {
		System.out.println("------- Data from window: ----");
		int[] date = date1.getDate();
		
		System.out.println(" minute: " + date[0] );
		System.out.println(" hour:   " + date[1] );
		System.out.println(" day:    " + date[2] );
		System.out.println(" month:  " + date[3]   );
		System.out.println(" year:   " + date[4]   );
	}

	
	/**
	 * main
	 * @param args
	 */
	public static void main(String[] args) {
		new GameDays( "Playoff Game" );
	}
}
